package com.netdisk.vo;
/**
 * 用户注册 ,需要完成
 * 1.持久化这个用户的信息.
 * 2分配 capacity
 * @author chenlong
 */
import java.security.NoSuchAlgorithmException;

import com.netdisk.entity.User;
import com.netdisk.util.EncrypSHA;

public class UserInfo {
	private String loginName;
	private String loginPassword; 
	private String loginPasswords;
	private String userMail;

	private String userName;
	private String userQq; 
	public UserInfo(){}
	
	public String getLoginName() {
		return loginName;
	}

	public String getLoginPassword() {
		return loginPassword;
	}

	public String getLoginPasswords() {
		return loginPasswords;
	}

	public String getUserMail() {
		return userMail;
	}

	public String getUserName() {
		return userName;
	}

	public String getUserQq() {
		return userQq;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public void setLoginPassword(String loginPassword) {
		this.loginPassword = loginPassword;
	}

	public void setLoginPasswords(String loginPasswords) {
		this.loginPasswords = loginPasswords;
	}

	public void setUserMail(String userMail) {
		this.userMail = userMail;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public void setUserQq(String userQq) {
		this.userQq = userQq;
	}
	
	public User getUser() throws NoSuchAlgorithmException{
		User user = new User();
		user.setLoginName(this.loginName);
		String encPassword = EncrypSHA.eccrypt(loginPassword);
		user.setLoginPassword(encPassword); //sha加密
		user.setUserName(userName);
		user.setUserQq(this.userQq);
		user.setUserMail(this.userMail);
		return user;
	}
	@Override
	public String toString() {
		return "UserInfo [loginName=" + loginName + ", loginPassword="
				+ loginPassword + ", loginPasswords=" + loginPasswords
				+ ", userName=" + userName + ", userQq=" + userQq
				+ ", userMail=" + userMail + "]";
	}
	
}
